import PageContent from '@/components/page-content'
import { ref } from 'vue'

export function usePageSearch() {
  // 获取pageContentRef组件的属性与方法
  const pageContentRef = ref<InstanceType<typeof PageContent>>()
  /**
   * handleResetClick 重置按钮的回调函数
   */
  const handleResetClick = () => {
    pageContentRef.value?.getPageData()
  }
  /**
   * 搜索按钮的回调函数
   * @param queryInfo 携带的search搜索框的信息
   */
  const handleQueryClick = (queryInfo: any) => {
    pageContentRef.value?.getPageData(queryInfo)
  }

  return [handleResetClick, handleQueryClick, pageContentRef]
}
